﻿using System;
using System.Collections.Generic;
using System.Text;

namespace 继承_中_02学生
{
    // 2设计一个学生类Student,
    //包括的属性有姓名name，年龄age，学位degree。
    //由学生类Student
    //派生出专科生类Specialty和本科生类Undergraduate
    //专科生类包含的属性有专业spec,
    //本科生类包括的属性有研究方向drec。
    //每个类都有相关数据的输出方法。最后在一个测试类中对设计的类进行测试。 
    //要求测试结果如下： 

   

    class Student
    {
        public string _name { get; set; }
        public double _age { get; set; }
        public string _degree { get; set; }

        //public string Name { get => name; set => name = value; }
        //public double Age { get => age; set => age = value; }
        //public string Degree { get => degree; set => degree = value; }
        public Student(string name, double age, string degree)
        {
            this._age = age;
            this._name = name;
            this._degree = degree;
        }

        
    }
    class Specialty : Student
    {
        private string _spec;

        public string Spec { get => _spec; set => _spec = value; }

        public Specialty(string spec ,string name, double age, string degree):base(name,age,degree)
        {
            this._spec = spec;
        }
        //姓名：王雷 年龄：17  学位：专科 专业：java
        public void Outs()
        {
            Console.WriteLine("姓名：{0}  年龄：{1}  学位：{2}   专业：{3}",_name,_age,_degree,_spec);
        }
        
    }
    class Undergraduate : Student
    {
        public string _drec;
        public Undergraduate(string drec, string name, double age, string degree) : base(name, age, degree)
        {
            this._drec = drec;
        }
        public void Uout()
        {
            Console.WriteLine("姓名：{0}  年龄：{1}  学位：{2}   研究方向：{3}", _name, _age, _degree, _drec);
        }
    }
}

